package Part5_Annotation;

import java.lang.annotation.Target;
import java.util.Objects;

/**
 * ClassName: Customer
 * Package: IntelliJ IDEA
 * Description:
 * Written by HanXu
 * Create 2024.05.08 16:13
 */

@Table(value = "t_customer")
public class Customer {

    @Column(columnName = "cust_name",columnType = "varchar(15)")
    private String name;

    @Column(columnName = "cust_age",columnType = "int")
    public int age;

    public Customer() {
    }

    public Customer(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Customer)) return false;
        Customer customer = (Customer) o;
        return age == customer.age && Objects.equals(name, customer.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, age);
    }

    @Override
    public String toString() {
        return "Customer{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
